<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\CaptchaDTO;
use App\Http\Services\PlatformService;
use App\Http\Traits\ResponseJson;

class PlatformController extends Controller
{
    use ResponseJson;

    protected $platformService;

    public function __construct(PlatformService $platformService)
    {
        $this->platformService = $platformService;
    }

    /**
     * 图形验证码生成
     * @return \Illuminate\Http\JsonResponse
     */
    public function captchaCreate()
    {
        $data = $this->platformService->captchaCreate();

        return $this->returnJson($data);
    }

    public function validateCaptcha(CaptchaDTO $captchaDTO)
    {
        $data = $this->platformService->validateCaptcha($captchaDTO);

        return $this->returnJson($data);
    }

    public function payMethodList()
    {
        $data = $this->platformService->payMethodList();

        return $this->returnJson($data);
    }

}
